package com.appistry.storage;

import java.io.InputStream;
import java.util.List;

import com.appistry.storage.exception.StorageManagerException;

public interface Storage {	
	// Get all files
	public List<File> getFiles(String path) throws StorageManagerException;
	public List<File> getFilesWithMetaData(String path) throws StorageManagerException;
	public File getFileRef(String path) throws StorageManagerException;
	
	// File (Get)
	public InputStream getFile(String path) throws StorageManagerException;
	public InputStream getFile(String path, int minReadCopies) throws StorageManagerException;
	public InputStream getFile(String path, String version) throws StorageManagerException;
	public InputStream getFile(String path, int minReadCopies, long offset, long length) throws StorageManagerException;
	public InputStream getFile(String path, long offset, long length) throws StorageManagerException;
	public InputStream getFile(String path, String version, int minReadCopies) throws StorageManagerException;
	public InputStream getFile(String path, String version, int minReadCopies, long offset, long length) throws StorageManagerException;
	
	// File (Add,Move,Delete)
	public void putFile(String fileName, long length, InputStream content) throws StorageManagerException;
	public void putFile(String fileName, InputStream content) throws StorageManagerException;
	public void putFile(String fileName, InputStream content, int copies, int minCopies, int minReadCopies) throws StorageManagerException;	
	public void moveFile(String fileNameSource, String fileNameDest) throws StorageManagerException;
	public void deleteFile(String fileName) throws StorageManagerException;
	
	// Territories
	public List<String> getTerritories() throws StorageManagerException;
	
	// Workers
	public Worker getWorker(String ip) throws StorageManagerException;
	public List<Worker> getWorkers() throws StorageManagerException;
	public List<Worker> getWorkers(boolean showDeleted) throws StorageManagerException;
	public List<Worker> getWorkers(String territory) throws StorageManagerException;
	
	// Add & Remove Workers
	public void addWorker(String ip) throws StorageManagerException;
	public void removeWorker(String ip) throws StorageManagerException;	
}
